package com.eastfair.venueservice.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 服务订单
 * </p>
 *
 * @author dqq
 * @date 2023-05-11
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ServiceOrderOrderSourceEnum", description = "订单来源 #{ONLINE_BOOK:线上预定;ON_SITE_ORDER:现场预定;REPORT_ORDER:报馆订单;WORK_OVERTIME_ORDER:加班订单;BUILDER_REPORT:搭建商报馆订单;BUILDER_ONLINE_BOOK:搭建商线上预定;HOME_BUILDER_ORDER:主场预定的搭建商订单;HOME_EXHIBITOR_ORDER:主场预定的展商订单;VENUE_HOME_REPAIR_ORDER:场馆给主场下发的保修订单;HOME_BUILDER_REPAIR_ORDER:主场给搭建商下发的报修订单;SPONSOR_ORDER:主办预定订单-枚举")
public enum ServiceOrderOrderSourceEnum implements BaseEnum {

    /**
     * ONLINE_BOOK="线上预定"
     */
    ONLINE_BOOK("线上预定"),
    /**
     * ON_SITE_ORDER="现场预定"
     */
    ON_SITE_ORDER("现场预定"),
    /**
     * REPORT_ORDER="报馆订单"
     */
    REPORT_ORDER("报馆订单"),
    /**
     * WORK_OVERTIME_ORDER="加班订单"
     */
    WORK_OVERTIME_ORDER("加班订单"),
    /**
     * BUILDER_REPORT="搭建商报馆订单"
     */
    BUILDER_REPORT("搭建商报馆订单"),
    /**
     * BUILDER_ONLINE_BOOK="搭建商线上预定"
     */
    BUILDER_ONLINE_BOOK("搭建商线上预定"),
    /**
     * HOME_BUILDER_ORDER="主场预定的搭建商订单"
     */
    HOME_BUILDER_ORDER("主场预定的搭建商订单"),
    /**
     * HOME_EXHIBITOR_ORDER="主场预定的展商订单"
     */
    HOME_EXHIBITOR_ORDER("主场预定的展商订单"),
    /**
     * VENUE_HOME_REPAIR_ORDER="场馆给主场下发的保修订单"
     */
    VENUE_HOME_REPAIR_ORDER("场馆给主场下发的保修订单"),
    /**
     * HOME_BUILDER_REPAIR_ORDER="主场给搭建商下发的报修订单"
     */
    HOME_BUILDER_REPAIR_ORDER("主场给搭建商下发的报修订单"),
    /**
     * SPONSOR_ORDER="主办预定订单"
     */
    SPONSOR_ORDER("主办预定订单"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static ServiceOrderOrderSourceEnum match(String val, ServiceOrderOrderSourceEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ServiceOrderOrderSourceEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(ServiceOrderOrderSourceEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "ONLINE_BOOK,ON_SITE_ORDER,REPORT_ORDER,WORK_OVERTIME_ORDER,BUILDER_REPORT,BUILDER_ONLINE_BOOK,HOME_BUILDER_ORDER,HOME_EXHIBITOR_ORDER,VENUE_HOME_REPAIR_ORDER,HOME_BUILDER_REPAIR_ORDER,SPONSOR_ORDER", example = "ONLINE_BOOK")
    public String getCode() {
        return this.name();
    }

}
